//
//  Kanbox_TrendDetailViewController_1.m
//  fxxiaoke
//
//  Created by 鞠超 on 2016/10/15.
//  Copyright © 2016年 jc. All rights reserved.
//

#import "Kanbox_TrendDetailViewController_1.h"

@interface Kanbox_TrendDetailViewController_1 ()

@end

@implementation Kanbox_TrendDetailViewController_1

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self p_navi];
    
    [self p_setupView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - navi
- (void )p_navi
{
    _btnLeft.hidden = YES;
    _lblLeft.hidden = YES;
    _btnRight.hidden = YES;
    _lblRight.hidden = YES;
    
    _lblTitle.text = [NSString stringWithFormat:@"%@",self.str_title];
    _topView.backgroundColor = navi_bar_bg_color;
    
    //左返回
    UIImageView * image_LeftRetrun = [[UIImageView alloc] initWithFrame:CGRectMake(11, 31.5, 25, 25)];
    image_LeftRetrun.userInteractionEnabled = YES;
    image_LeftRetrun.image = [UIImage imageNamed:@"Left-return.png"];
    [_topView addSubview:image_LeftRetrun];
    
    UILabel * lbl_return = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(image_LeftRetrun.frame) - 6, 35, 70, 15)];
    lbl_return.text = @"网盘动态";
    lbl_return.textColor = [UIColor whiteColor];
    lbl_return.font = [UIFont systemFontOfSize:17];
    [_topView addSubview:lbl_return];
    
    UIButton * btn_return = [UIButton buttonWithType:(UIButtonTypeSystem)];
    btn_return.frame = CGRectMake(10, 22, 90, 40);
    [_topView addSubview:btn_return];
    [btn_return addTarget:self action:@selector(btn_returnAction:) forControlEvents:(UIControlEventTouchUpInside)];
    
    //
    UIImageView * image_share = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 35, 32, 20, 20)];
    image_share.image = [UIImage imageNamed:@"Share_ Omit.png"];
    [_topView addSubview:image_share];
    
    UIButton * btn_share = [UIButton buttonWithType:(UIButtonTypeSystem)];
    btn_share.frame = CGRectMake(SCREEN_WIDTH - 10 - 35, 24.5, 35, 35);
    [_topView addSubview:btn_share];
    [btn_share addTarget:self action:@selector(btn_shareAction:) forControlEvents:(UIControlEventTouchUpInside)];
}

//左返回
- (void )btn_returnAction:(UIButton *)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

//显示tabbar
- (void )viewWillAppear:(BOOL)animated
{
    [(AppDelegate *)[[UIApplication sharedApplication] delegate] hiddenTabBar];
}

//右设置
- (void )btn_shareAction:(UIButton *)sender
{
//    NSLog(@"设置");
    
    UIAlertController * alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:(UIAlertControllerStyleActionSheet)];
    [self presentViewController:alert animated:YES completion:^{
    }];
    
    UIAlertAction * action_Forwarding = [UIAlertAction actionWithTitle:@"用其他应用打开" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
        
        NSLog(@"用其他应用打开");
    }];
    [alert addAction:action_Forwarding];
    
    UIAlertAction * action_Cancel = [UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) {
    }];
    [alert addAction:action_Cancel];
}

#pragma mark - 布局
- (void )p_setupView
{
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    UIWebView * webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64)];
    webView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    NSString * path = @"http://www.baidu.com";
    NSURL * url = [NSURL URLWithString:path];
    [webView loadRequest:[NSURLRequest requestWithURL:url]];
    
    [self.view addSubview:webView];
}

//-(void)loadDocument:(NSString*)documentName inView:(UIWebView*)webView
//{
//    NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:nil];
//    NSURL *url = [NSURL fileURLWithPath:path];
//    NSURLRequest *request = [NSURLRequest requestWithURL:url];
//    [webView loadRequest:request];
//}
//
//[self loadDocument:@"test.doc" inView:self.myWebview];
















@end
